//数组长度做计算

/**
 * 构造一个长度为Length的数组
 */
type BuildArray<Length extends number, Ele=unknown, Arr extends unknown[] = []> = 
 Arr['length'] extends Length 
 ? Arr
 : BuildArray<Length, Ele, [...Arr, Ele]>;

/**
 * 减法
 */
type Subtract<Num1 extends number, Num2 extends number> = BuildArray<Num1> extends [...arr1: BuildArray<Num2>, ...arr2: infer Rest]
? Rest['length']
: never;

/**
 * 加法
 */
type Add<Num1 extends number, Num2 extends number> = [...arr1: BuildArray<Num1>, ...arr2:BuildArray<Num2>]['length']

type SubtractResult = Subtract<12, 4>;

type AddResult = Add<3,7>;